/**
 * 布局插件样式
 */

.layout-plugin {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 500px;
}

/* ==================== 头部样式 ==================== */

.schedule-header {
  align-items: center;
  background: var(--schedule-primary-color);
  border-radius: var(--schedule-border-radius) var(--schedule-border-radius) 0 0;
  color: var(--schedule-text-inverse);
  display: flex;
  gap: var(--schedule-spacing-md);
  justify-content: space-between;
  padding: var(--schedule-spacing-md) var(--schedule-spacing-lg);
}

.view-controls {
  display: flex;
  gap: var(--schedule-spacing-sm);
}

.date-navigation {
  align-items: center;
  display: flex;
  gap: var(--schedule-spacing-md);
}

.current-range {
  font-size: var(--schedule-font-size-lg);
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

.nav-btn {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--schedule-text-inverse);
  cursor: pointer;
  display: flex;
  font-size: 24px;
  height: 32px;
  justify-content: center;
  transition: background var(--schedule-transition-fast);
  width: 32px;
}

.nav-btn:hover {
  background: rgb(255, 255, 255, 0.2);
}

.header-actions {
  display: flex;
  gap: var(--schedule-spacing-sm);
}

.btn {
  border: none;
  border-radius: var(--schedule-border-radius);
  cursor: pointer;
  font-size: var(--schedule-font-size-sm);
  font-weight: 500;
  outline: none;
  padding: 8px 16px;
  transition: all var(--schedule-transition-fast);
}

.btn-primary {
  background: var(--schedule-text-inverse);
  color: var(--schedule-primary-color);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary.active {
  background: var(--schedule-secondary-color);
  color: var(--schedule-text-inverse);
}

/* ==================== 布局主体 ==================== */

.layout-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ==================== 员工列表样式 ==================== */

.employee-list {
  background: var(--schedule-bg-secondary);
  border-right: 1px solid var(--schedule-border-color);
  display: flex;
  flex-direction: column;
  width: 200px;
}

.employee-list-header {
  background: var(--schedule-bg-primary);
  border-bottom: 2px solid var(--schedule-border-color);
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
}

.employee-header-cell {
  align-items: center;
  display: flex;
  flex: 1;
  font-weight: 600;
  height: 60px;
  justify-content: center;
  padding: var(--schedule-spacing-md);
  text-align: center;
}

.employee-list-body {
  flex: 1;
  overflow-y: auto;
}

.employee-item {
  align-items: center;
  border-bottom: 1px solid var(--schedule-border-color);
  display: flex;
  justify-content: space-between;
  min-height: 60px;
  padding: var(--schedule-spacing-md);
}

.employee-info {
  align-items: center;
  display: flex;
  gap: var(--schedule-spacing-sm);
}

.employee-avatar {
  border-radius: 50%;
  height: 32px;
  object-fit: cover;
  width: 32px;
}

.employee-name {
  font-weight: 500;
}

.employee-position {
  color: var(--schedule-text-secondary);
  font-size: var(--schedule-font-size-xs);
}

.employee-list-empty {
  color: var(--schedule-text-secondary);
  padding: var(--schedule-spacing-xl);
  text-align: center;
}

/* ==================== 排班网格样式 ==================== */

.schedule-grid {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: auto;
}

.time-header {
  background: var(--schedule-bg-primary);
  border-bottom: 2px solid var(--schedule-border-color);
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
}

.time-cell {
  align-items: center;
  border-right: 1px solid var(--schedule-border-color);
  display: flex;
  font-weight: 500;
  height: 60px;
  justify-content: center;
  min-width: 100px;
  padding: var(--schedule-spacing-md);
  text-align: center;
  white-space: pre-line;
}

.schedule-rows {
  flex: 1;
}

.schedule-row {
  border-bottom: 1px solid var(--schedule-border-color);
  display: flex;
  min-height: 60px;
}

.time-slot {
  border-right: 1px solid var(--schedule-border-color);
  cursor: pointer;
  min-width: 100px;
  position: relative;
  transition: background var(--schedule-transition-fast);
}

.time-slot:hover {
  background: var(--schedule-bg-hover);
}

.time-slot[data-droppable='true'] {
  background: rgb(52, 152, 219, 0.1);
}

.schedule-empty {
  color: var(--schedule-text-secondary);
  padding: var(--schedule-spacing-xl);
  text-align: center;
}

/* ==================== 班次样式 ==================== */

.shift {
  border-radius: var(--schedule-border-radius);
  color: var(--schedule-text-inverse);
  cursor: pointer;
  inset: 4px;
  overflow: hidden;
  padding: var(--schedule-spacing-sm);
  position: absolute;
  transition:
    transform var(--schedule-transition-fast),
    box-shadow var(--schedule-transition-fast);
  user-select: none;
  z-index: 2;
}

.shift:hover {
  box-shadow: var(--schedule-shadow-md);
  transform: scale(1.02);
}

.shift-morning {
  background: var(--schedule-primary-color);
}

.shift-afternoon {
  background: var(--schedule-secondary-color);
}

.shift-night {
  background: var(--schedule-info-color);
}

.shift-custom {
  background: var(--schedule-warning-color);
}

.shift-content {
  font-size: var(--schedule-font-size-sm);
  font-weight: 500;
}

.shift-note {
  font-size: var(--schedule-font-size-xs);
  margin-top: 2px;
  opacity: 0.9;
}

.shift[draggable='true'] {
  cursor: move;
}

/* ==================== 响应式样式 ==================== */

@media (width <= 768px) {
  .schedule-header {
    align-items: stretch;
    flex-direction: column;
  }

  .view-controls,
  .date-navigation,
  .header-actions {
    justify-content: center;
  }

  .layout-body {
    flex-direction: column;
  }

  .employee-list {
    border-bottom: 1px solid var(--schedule-border-color);
    border-right: none;
    max-height: 150px;
    width: 100%;
  }

  .employee-list-body {
    display: flex;
    overflow-x: auto;
  }

  .employee-item {
    flex-shrink: 0;
  }

  .time-cell {
    min-width: 80px;
  }

  .time-slot {
    min-width: 80px;
  }
}
